#include <iostream>
#include <vector>

using namespace std;

class Solution {
public:
    int removeDuplicates(vector<int> &nums) {
        int last = nums[0];
        for (size_t i = 1; i < nums.size(); i++) {
            if (nums[i] == last) {
                nums.erase(nums.begin() + i);
                i--;
            } else {
                last = nums[i];
            }
        }
        return nums.size();
    }
};

int main(void) {
    cout << "删除重复元素(简单)" << endl;
    std::vector<int> vec = {1, 1};

    cout << (new Solution())->removeDuplicates(vec) << endl;

    for (auto val : vec) {
        cout << val << ", ";
    }
    cout << endl;
    return 0;
}